<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>湖北康正物业服务有限公司</title>
<LINK href="images/css.css" type="text/css" rel="stylesheet">
<script type="text/javascript">
	function checkForm() {
		var districtId = document.forms[0].districtId.value;
		var name = document.forms[0].name.value;
				
		if (districtId == null || districtId == "") {
			alert("请输入物业服务处编号！");
			return false;
		} else if (districtId.length!=2) {
			alert("请输入2位物业服务处编号！");
			return false;
		}
		if (name == null || name == "") {
			alert("请输入物业服务处名称！");
			return false;
		}
		return true;
	}
</script>
</head>
<body>
  <table class="tableline" cellspacing="1" cellpadding="0" width="100%" border="0">
    <html:form action="district.do?method=save" method="post" onsubmit="return checkForm();">
    <tr>
      <td class="STYLE4" align="center" bgcolor="#ffffff" colspan="2" height="40">添加物业服务处</td>
    </tr>
    <tr>
      <td width="217" height="26" align="right" bgcolor="#ffffff">物业服务处编号:</td>
      <td width="773" bgcolor="#ffffff"><label for="textfield"></label>
        &nbsp;<html:text property="districtId" />&nbsp;&nbsp;<span style="color:#5f9c12;">请输入2位数字，例如01</span>
        <font color="red">${districtIdError }${districtIdRequest }</font></td>
    </tr>
    <tr>
      <td height="26" align="right" bgcolor="#ffffff">物业服务处名称:</td>
      <td bgcolor="#ffffff"><label for="textfield2"></label>
       &nbsp;<html:text property="name" value="${district.name }"/>
        &nbsp;<html:submit value="增加物业服务处" />&nbsp;<font color="red">${districtNameError }</font></td>
    </tr>
    </html:form>
    <tr>
      <td colspan="2" align="center" bgcolor="#ffffff">
      <table width="100%" border="0">
        <tr align="center">
          <td width="25%" height="25">物业服务处编号</td>
          <td width="25%">物业服务处名称</td>
          <td width="25%">操作</td>
        </tr>
        <c:if test="${!empty districtList}">
				<c:forEach items="${districtList}" var="district">
        <tr align="center">
          <td height="25">${district.districtId }</td>
          <td>${district.name }</td>
          <td><a href="district.do?method=update&id=${district.id }">编辑</a>&nbsp;<a href="district.do?method=delete&id=${district.id }">删除</a></td>
        </tr>
        </c:forEach>
        </c:if>
      </table>
      </td>
    </tr>
  </table>
</body>
</html>